﻿package mortal.game.view.ThanksGiving.item
{
    import com.mui.controls.*;
    import extend.language.*;
    import mortal.common.global.*;
    import mortal.game.manager.*;
    import mortal.game.resource.*;
    import mortal.game.view.ThanksGiving.data.*;
    import mortal.game.view.common.*;

    public class ThanksGivingRedBagCell extends GCellRenderer
    {
        protected var _reTime:GTextFiled;
        protected var _begTip:GImageBitmap;
        protected var _overFlag:GImageBitmap;

        public function ThanksGivingRedBagCell()
        {
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            this._reTime = UIFactory.gTextField("", 566, 65, 150, 20, this, GlobalStyle.textFormatLv);
            this._begTip = UIFactory.gImageBitmap(ImagesConst.ThanksGivingRedBagBe, 565, 33, this);
            this._overFlag = UIFactory.gImageBitmap(ImagesConst.ThanksGivingRedBagEnd, 581, 43, this);
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            this._reTime = null;
            this._begTip = null;
            this._overFlag = null;
            super.disposeImpl(param1);
            return;
        }// end function

        override public function set data(param1:Object) : void
        {
            var _loc_2:* = param1.index as int;
            this.updateTime(_loc_2);
            return;
        }// end function

        public function updateTime(param1:int) : void
        {
            var _loc_5:int = 0;
            var _loc_6:int = 0;
            var _loc_2:* = ClockManager.instance.nowDate;
            var _loc_3:* = ThanksGivingUtil.getCompDateByIndex(param1);
            var _loc_4:* = (_loc_3.time - _loc_2.time) / 1000;
            if (_loc_4 <= 0)
            {
                var _loc_7:Boolean = false;
                this._reTime.visible = false;
                this._begTip.visible = _loc_7;
                this._overFlag.visible = true;
            }
            else
            {
                var _loc_7:Boolean = true;
                this._reTime.visible = true;
                this._begTip.visible = _loc_7;
                this._overFlag.visible = false;
                _loc_5 = _loc_4 / 3600;
                _loc_6 = _loc_4 / 60 % 60;
                this._reTime.text = "" + Language.getStringByParam(71410, _loc_5, _loc_6);
            }
            return;
        }// end function

    }
}
